/*************************************************************************
    > File Name    : test.cc
    > Author       : LiuLei
    > Mail         : 2261459486@qq.com 
    > Created Time : 2022年11月29日 星期二 21时43分23秒
 ************************************************************************/

#include "../../include/WebProcessor/DirScanner.h"
#include "../../include/WebProcessor/PageLib.h"
#include "../../include/WebProcessor/PageLibPreprocessor.h"
#include "../../include/WebProcessor/WebPage.h"
#include <iostream>
#include <string>
using std::cout;
using std::endl;
using std::string;

void test1()
{
    string s1 = "<docid>1</docid><title>ETCD的内存问题</title><url>https://coolshell.cn/articles/22242.html</url>"
        "<content>今天跟大家分享一个etcd的内存大量占用的问题，这是前段时间在我们开源软件Easegress中遇到的问题，问题是比较简</content>";
    string s2 = "<docid>1</docid><title>你的名字叫什么</title><url>https://coolshell.cn/articles/22242.html</url>"
        "<content></content>";
    /* string s2 = "<docid>1</docid><title>你的名字叫什么</title><url>https://coolshell.cn/articles/22242.html</url>" */
    /*     "<content>所以随便写点什么把，就这样。</content>"; */
    WordSegmentation _jieba;
    WebPage w1(s1, Configuration::getInstance(), _jieba);
    WebPage w2(s2, Configuration::getInstance(), _jieba);

    cout << (w1 == w2) << endl;
}

void test2()
{
    Configuration *conf = Configuration::getInstance();
    DirScanner dir;
    PageLib p(conf, dir);
    /* p.create(); */
    p.storePageLib();
    p.storeOffsetLib();
}

void test3()
{
    Configuration *conf = Configuration::getInstance();
    PageLibPreprocessor p(*conf);
    p.doProcess();
}

int main(int argc, char *argv[])
{
    /* test1(); */
    test2();
    /* test3(); */    
    return 0;
}
